<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
			 xmlns:s="http://www.w3.org/2001/XMLSchema"
			 xmlns:s0="http://tempuri.org/" 
			 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
			 xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
			 xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/">
	<xsl:param name="path"/>
	<xsl:param name="method"/>
	<xsl:param name="argument"/>
  <xsl:variable name="service.name">
    <xsl:choose>
      <xsl:when test="//*[local-name()='service']/@name"><xsl:value-of select="//*[local-name()='service']/@name"/></xsl:when>
      <xsl:otherwise>Jazz!</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
	    <xsl:variable name="method.response" select="//*[local-name()='element'][@name=concat($method,'Response')]"/>
	    <xsl:variable name="method.element" select="$method.response/*[local-name()='complexType']/*[local-name()='sequence']/*[local-name()='element']"/>
	    <xsl:variable name="argument.list" select="//*[local-name()='element'][@name=$method]/*[local-name()='complexType']/*[local-name()='sequence']/*[local-name()='element']"/>
	    <xsl:variable name="service.documentation" select="//*[local-name()='service']/*[local-name()='documentation']"/>
		<xsl:variable name="service.endpoint" select="//*[local-name()='service']/*[local-name()='port']/*[local-name()='address']/@location"/>
  <xsl:variable name="service.namespace" select="//*[local-name()='schema']/@targetNamespace"/>
  <xsl:variable name="service.prefix" select="//*[local-name()='binding']/@type"/>
  <xsl:variable name="datatypes.simple">base64Binary,hexBinary,boolean,byte,dateTime,date,time,decimal,double,float,hexBinary,int,unsignedShort,integer,long,unsignedInt,QName,short,unsignedByte,string,anySimpleType,</xsl:variable>

  <xsl:variable name="method.msg" select="//*[local-name()='part'][substring-after(@element,':')=$method]/.."/>
  <xsl:variable name="method.input" select="//*[local-name()='input'][substring-after(@message,':')=$method.msg/@name]"/>
  <xsl:variable name="method.output" select="//*[local-name()='output'][substring-after(@message,':')=$method.msg/@name]"/>
  <xsl:variable name="method.portype.output" select="$method.input/following-sibling::*[local-name()='output']/@message"/>
  <xsl:variable name="method.message.output" select="//*[local-name()='message'][substring-after($method.portype.output,':')=@name]/*[local-name()='part']/@element"/>
  <xsl:variable name="method.response.element" select="//*[local-name()='element'][substring-after($method.message.output,':')=@name]"/>
  <xsl:variable name="method.response.element.element" select="$method.response.element/*[local-name()='complexType']/*[local-name()='sequence']/*[local-name()='element']"/>

<xsl:output method="html" version="4.0"
encoding="iso-8859-1" />
  
<xsl:template match="/"> 
    <html>
      <title>JAZZ</title>
		<style>
      code {font-size:9pt} 
      input {margin:1px}
      form {padding:2px;margin:2px;background-color:whitesmoke}
      .datatype {font-weight:bold;color:#336699}
      a.normal {font-weight:normal;color:blue}
      .comment {font-size:7pt;color:#ff0099;display:none}
    </style>
      <script language="javascript">
        function bugout ()
        {
           var d=document.getElementsByTagName ("span");
           for (var i=0;i!=d.length;i++)
           {
            if (d[i].className=="comment")
            {
                ison=d[i].style.display=="inline";
                d[i].style.display=ison?"none":"inline";
            }
           }
        }
        function toggle (element,picture)
        {
        var x=document.getElementById(element),d=x.style.display=='none';x.style.display=d?'inline':'none';
        var p=document.getElementById(picture);p.src=d?"/webservices/images/explorer/sminus.gif":"/webservices/images/explorer/splus.gif";
        }
      </script>
		<link type='text/css' rel='Stylesheet' href='http://www.101stratford.com/webservices/styles/wsdl.css' />
		<body>
			<div id='content'>
				<p class="heading1">
					<xsl:value-of select="$service.name"/>
				</p>

        <xsl:if test="count(//jazz) = 0">
          <div align="right">
            Back to <a href="/webservices/public.jazz" style="font-size:7pt">JAZZ Home</a>
          </div>
        </xsl:if>
        
        <xsl:choose>
          
          <xsl:when test="($argument='struct') and (contains($method, ':'))">
            <a style="font-weight:normal;color:blue" href="/{$path}">Home</a>&#160;:
            <xsl:call-template name="delimiter.parse">
              <xsl:with-param name="for" select="$method"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:when test="($argument='struct') and (//*[local-name()='complexType'][@name=$method])">
            <a style="font-weight:normal;color:blue" href="/{$path}">Home</a>&#160;<br/><br/>
          <xsl:call-template name="jazz.struct"/>
        </xsl:when>
        <xsl:when test="($argument='struct') and (//*[local-name()='element'][@name=$method]/*[local-name()='complexType'])">
          <a style="font-weight:normal;color:blue" href="/{$path}">Home</a>&#160;<br/><br/>
            <xsl:call-template name="jazz.struct">
              <xsl:with-param name="group" select="//*[local-name()='element'][@name=$method][1]/*[local-name()='complexType'][1]"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:when test="//*[local-name()='simpleType'][@name=$method]">
            <xsl:call-template name="jazz.enum"/>
          </xsl:when>
          <xsl:when test="count(//jazz) &gt; 0">
            <xsl:call-template name="jazz.main"/>
          </xsl:when>
          <xsl:when test="string-length($method) &gt; 0">
            <xsl:call-template name="jazz.method"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="jazz.service"/>
          </xsl:otherwise>
        </xsl:choose>
      </div>
    </body>
  </html>
</xsl:template>

<xsl:template name="form.member.create">
  <xsl:param name="button.id">Method</xsl:param>
  <xsl:param name="button.method"/>
  <xsl:param name="button.type"/>
  <span class="comment" color="green">&lt;--form.member.create--&gt;</span>
  <form action="/{$path}/{$method}" method="post">
    <input type="hidden" name="Endpoint"  value="{$service.endpoint}"/>
    <input type="hidden" name="Namespace"  value="{$service.namespace}"/>
    <xsl:if test="string-length($button.method) &gt; 0">
      Add as
      <input type="radio" onclick="document.getElementById('{$button.id}Type').disabled=false" id="type1"  name="{$button.id}MemberType" value="0" checked="checked"/>
      <label for="type1">Method</label>
      <input type="radio" onclick="document.getElementById('{$button.id}Type').disabled=true" id="type2" name="{$button.id}MemberType" value="1"/><label for="type2">Structure</label>
      <input type="radio" onclick="document.getElementById('{$button.id}Type').disabled=true" id="type3" name="{$button.id}MemberType" value="2"/><label for="type3">Enum</label>
    </xsl:if>
    <table>
      <tr>
        <td>Name</td>
        <td>
          <xsl:if test="string-length($button.type) = 0">Type</xsl:if>
        </td>
        <td>
          &#160;
        </td>
      </tr>
      <tr>
        <td>
          <input name="{$button.id}Name"/>
        </td>
        <td>
          <xsl:if test="string-length($button.type) = 0">
            <select name="{$button.id}Type">
              <option value="">(Choose)</option>
              <xsl:call-template name="data.types.list"/>
            </select>
          </xsl:if>
        </td>
        <td nowrap="nowrap">
          <input type="submit" name="Save{$button.id}" value="Create"/>
          <input type="checkbox" id="type4"  name="{$button.id}IsArray"  value="1"/>
          <label for="type4">Return value as an array</label>
        </td>
      </tr>
      <tr>
        <td colspan="3">
        </td>
      </tr>
    </table>
  </form>
</xsl:template>

<xsl:template name="form.webservice.create">
  <xsl:param name="button.id">CreateClass</xsl:param>
  <xsl:param name="button.value">Create</xsl:param>
  <xsl:param name="button.state"/>
  <xsl:param name="class.name"/>
  <xsl:param name="class.namespace">http://tempuri.org</xsl:param>
  <xsl:param name="class.prefix">s0</xsl:param>
  <xsl:param name="class.endpoint"/>
  

  <form action="/{$path}/{$method}" method="post">
    <table>
      <tr>
        <td>Name</td>
        <td>
          <xsl:choose>
            <xsl:when test="$button.state='disabled'">
              <xsl:value-of select="$class.name"/>
            </xsl:when>
            <xsl:otherwise>
              <input size="80"  name="ClassName" value="{$class.name}"/>
            </xsl:otherwise>
          </xsl:choose>
        </td>
      </tr>
      <tr>
        <td>Namespace</td>
        <td>
          <xsl:choose>
            <xsl:when test="$button.state='disabled'">
              <xsl:value-of select="$class.namespace"/>
            </xsl:when>
            <xsl:otherwise>
              <input size="80"  name="ClassNamespace" value="{$class.namespace}"/>
            </xsl:otherwise>
          </xsl:choose>
        </td>
      </tr>
      <tr>
        <td>Prefix</td>
        <td>
          <xsl:choose>
            <xsl:when test="$button.state='disabled'">
              <xsl:value-of select="$class.prefix"/>
            </xsl:when>
            <xsl:otherwise>
              <input size="80"  name="ClassPrefix" value="{$class.prefix}"/>
            </xsl:otherwise>
          </xsl:choose>
        </td>
      </tr>
      <tr>
        <td>Address</td>
        <td>
          <input size="80"  name="ClassAddress"  value="{$class.endpoint}"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <input type="submit" name="{$button.id}" value="{$button.value}"/>
          <xsl:if test="$button.state='disabled'">
            <font color="gray">
              NOTE: For existing webservices, only the address and description may be changed.
            </font>
          </xsl:if>
        </td>
      </tr>
    </table>
  </form>

</xsl:template>

<xsl:template name="data.types.list">
  <xsl:param name="for" select="$datatypes.simple"/>
  <xsl:param name="selected"/>
  <xsl:param name="me" select="substring-before($for,',')"/>
  <xsl:param name="next" select="substring-after($for,',')"/>
 
  <option value="s:{$me}">
    <xsl:if test="$me=$selected">
      <xsl:attribute name="selected">selected</xsl:attribute>
    </xsl:if>
    <xsl:value-of select="$me"/>
  </option>
  <xsl:choose>
    <xsl:when test="string-length($next) &gt; 0">
      <xsl:call-template name="data.types.list">
        <xsl:with-param name="for" select="$next"/>
        <xsl:with-param name="selected" select="$selected"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:for-each select="//*[local-name()='schema']/*[(local-name()='simpleType') or (local-name()='complexType')]">
        <option value="{concat(substring-before($service.prefix,':'),':',@name)}">
          <xsl:if test="@name=$selected">
            <xsl:attribute name="selected">selected</xsl:attribute>
          </xsl:if>
          <xsl:value-of select="@name"/>
        </option>
      </xsl:for-each>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template name="jazz.main">
  <span class="comment" color="green">&lt;--jazz.main--&gt;</span>
  <h3>
    Create blank webservice
  </h3>
  To create a blank webservice file and open it for editing, complete the form below and click the 'Create' button.
  <xsl:call-template name="form.webservice.create"/>

  <br/> <br/>

  <h3>
    Open existing webservice
  </h3>
  To open an existing public webservice file, select one from the list below.
  <br/> <br/>
  <table>
    <tr>
      <td>
        <font color="gray">Name</font>
      </td>
      <td>
        <font color="gray">Filename</font>
      </td>
      <td>
        <font color="gray">Size</font>
      </td>
      <td>
        <font color="gray">Date Last Modified</font>
      </td>
    </tr>
    <xsl:apply-templates select="//*[local-name()='file']"/>
  </table>
  <br/> <br/>

  <h3>
    Upload webservice file
  </h3>
  To upload a webservice file from your computer and open it for editing, enter the file path below and click the 'Upload' button.
  <form method="post" action="/{$path}/{$method}" enctype="multipart/form-data">
    <input size="80"  type="file" name="wsdlup"/>
    <input type="submit" value="Upload"/>
  </form>
  <h3>
    Copy webservice URL
  </h3>
  To copy a webservice file from a remote computer and open it for editing, enter the URL below and click the 'Copy' button.
  <form method="post" action="/{$path}/{$method}">
    <input size="80"  name="WSDLCopy"/>
    <input type="submit" value="Copy"/>
  </form>

</xsl:template>

<xsl:template name="jazz.service">

  <span class="comment" color="green">&lt;--jazz.service--&gt;</span>
  <p class="intro">
    <xsl:value-of select="$service.documentation"/>

    <h3>
      Webservice properties
    </h3>
    <xsl:call-template name="form.webservice.create">
      <xsl:with-param name="button.id">SaveClass</xsl:with-param>
      <xsl:with-param name="button.value">Save</xsl:with-param>
      <xsl:with-param name="button.state">disabled</xsl:with-param>
      <xsl:with-param name="class.name" select="$service.name"/>
      <xsl:with-param name="class.namespace" select="$service.namespace"/>
      <xsl:with-param name="class.endpoint" select="$service.endpoint"/>
      <xsl:with-param name="class.prefix" select="substring-before($service.prefix,':')"/>
    </xsl:call-template>
    The following operations are supported. <xsl:call-template name="service.wsdl"/>
  </p>
  <!--  <hr noshade="noshade"/>
    <xsl:call-template name="datatype.list.element"/>-->
  <hr noshade="noshade"/>
  <h3>
    Available methods
  </h3>
  To test any method on <xsl:value-of select="$service.name"/> or edit its properties, select any item in the list below.
  <br/>
  <br/>
  <xsl:choose>
    <xsl:when test="//*[local-name()='portType']/*[local-name()='operation']">
      <xsl:apply-templates select="//*[local-name()='portType']"/>
      <br/>
      <br/>
      <a href="#" style="font-weight:normal" onclick="var x=document.getElementById('msgsimplecomplex'),d=x.style.display;x.style.display=d=='none'?'inline':'none';"
                   >Show support classes</a>
      <br/>
      <div id="msgsimplecomplex" style="display:none">
      <xsl:call-template name="datatype.simple"/>
      <xsl:call-template name="datatype.complex"/>
      </div>
      <a href="#" style="font-weight:normal" onclick="var x=document.getElementById('msgsystem'),d=x.style.display;x.style.display=d=='none'?'inline':'none';"
                   >Show system generated members</a>
      <br/>
      <div id="msgsystem" style="display:none">
        <xsl:apply-templates select="//*[local-name()='portType']">
          <xsl:with-param name="hide">async</xsl:with-param>
        </xsl:apply-templates>
        <xsl:apply-templates select="//*[local-name()='portType']">
          <xsl:with-param name="hide">message</xsl:with-param>
        </xsl:apply-templates>
        <xsl:apply-templates select="//*[local-name()='portType']">
          <xsl:with-param name="hide">event</xsl:with-param>
        </xsl:apply-templates>
      </div>
    </xsl:when>
    <xsl:otherwise>
      <p>
        There are no methods defined in this class.
      </p>
    </xsl:otherwise>
  </xsl:choose>


  <hr noshade="noshade"/>
  <h3>
    Add Member
  </h3>
  To add a new member to <xsl:value-of select="$service.name"/>, complete the form below and click the 'Create' button.

  <xsl:call-template name="form.member.create">
    <xsl:with-param name="button.method">true</xsl:with-param>
  </xsl:call-template>

  <hr noshade="noshade"/>

  <h3>
    Export
  </h3>
  To create a script file that you can use to call or implement the methods in <xsl:value-of select="$service.name"/>, select a
  file type and language from the list below.
  <br/>
  <br/>
  <table cellpadding="1"  cellspacing="1" bgcolor="silver">
    <tr>
      <td valign="top" bgcolor="whitesmoke">
        Create <b>caller</b> file
        <table bgcolor="white" cellpadding="1"  cellspacing="1">
          <tr>
            <xsl:for-each select="//mask[@type='caller']">
              <td align="center" valign="bottom">
                <a target="_blank" style="font-size:7pt" href="/{$path}/__invoke__/{substring-before(@icon,'class')}">
                  <img border="0" src="/webservices/images/{@icon}.gif"/>
                  <br/>
                  <xsl:value-of select="@name"/>
                </a>
              </td>
            </xsl:for-each>
          </tr>
        </table>
      </td>
      <td valign="top" bgcolor="whitesmoke">
        Create <b>listener</b> file
        <table bgcolor="white" cellpadding="1"  cellspacing="1">
          <tr>
            <xsl:for-each select="//mask[@type='listener']">
              <td align="center" valign="bottom">
                <a target="_blank" style="font-size:7pt"  href="/{$path}/__invoke__/{substring-before(@icon,'class')}">
                  <img border="0" src="/webservices/images/{@icon}.gif"/>
                  <br/>
                  <xsl:value-of select="@name"/>
                </a>
              </td>
            </xsl:for-each>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  <!--<hr noshade="noshade"/>
    <h3>
      WSDL Source
    </h3>-->
</xsl:template>

<xsl:template name="jazz.method">
  <xsl:variable name="type" select="substring-after($method.element/@type,':')"/>
  <xsl:variable name="ref.key" select="//*[local-name()='schema']/*[local-name()='complexType'][@name=$type]"/>
  <span class="comment" color="green">&lt;--jazz.method--&gt;</span>
  <br/>
  <p class='intro'>
    Click <a href='/{$path}'>here</a> for a complete list of operations in <xsl:value-of select="$service.name"/>
  </p>

  <h2> 
    <xsl:value-of select="$method"/>
  </h2>
  <xsl:value-of select="//*[local-name()='operation'][@name=$method]/*[local-name()='documentation']"/>
  <form action="/{$path}/{$method}" method="post">
    <div style="font-size:8pt;font-weight:normal">
      Data type:
      <input type="hidden" value="{$method}"  name="MethodName"/>
      <select name="MethodType">
        <option value="">(Choose)</option>
        <xsl:call-template name="data.types.list">
          <xsl:with-param name="selected" select="substring-after($method.element/@type,':')"/>
        </xsl:call-template>
        <xsl:if test="not ($type)">
          <option selected="selected">
            <xsl:value-of select="$method.response.element.element/@name"/>  
          </option>
        </xsl:if>
      </select>
      <input type="checkbox"  name="MethodIsArray"  value="1" align="absmiddle">
        <xsl:if test="$method.element/@maxOccurs='unbounded'">
          <xsl:attribute name="checked">checked</xsl:attribute>
        </xsl:if>
      </input>Return value as an array
      <input type="submit" name="SaveMethod" value="Update">
        <xsl:if test="not ($type)">
          <xsl:attribute name="disabled">disabled</xsl:attribute>
        </xsl:if>
      </input>
      <input type="button" value="Debug" onclick=" bugout ()"/>
    </div>
  </form>

  <xsl:call-template name="service.wsdl"/>
  <hr noshade="noshade"/>
  <h3>Test</h3>
  To test the operation using the HTTP POST protocol, click the 'Invoke' button.
  <form action="/{$path}/{$method}" method="post"  target="_blank">
    <input type="hidden" name="Endpoint"  value="{$service.endpoint}"/>
    <input type="hidden" name="Namespace"  value="{$service.namespace}"/>
    <table>
      <tr>
        <xsl:call-template name="form.invoke"/>
      </tr>
      <tr>
        <td align="right" colspan="{count($argument.list)}">
          <input type="submit" name="Invoke"  value="Invoke"/>
        </td>
      </tr>
    </table>
  </form>

  <hr noshade="noshade"/>

  <h3>
    Add parameter
  </h3>
  <form action="/{$path}/{$method}" method="post">
    <table>
      <tr>
        <td>Name</td>
        <td>Type</td>
        <td>&#160;</td>
      </tr>
      <tr>
        <td>
          <input name="ArgumentName"/>
        </td>
        <td>
          <select name="ArgumentType">
            <option value="">(Choose)</option>
            <xsl:call-template name="data.types.list"/>
          </select>
        </td>
        <td>
          <input type="submit" name="SaveArgument" value="Create"/>
        </td>
      </tr>
      <tr>
        <td colspan="3">
          <input type="checkbox"  name="ArgumentIsArray"  value="1"/>Argument value is an array
        </td>
      </tr>
    </table>
  </form>

  <hr noshade="noshade"/>
  <h3>SOAP</h3>
  <p>The following is the XML request. </p>
  <table cellpadding="10">
    <tr>
      <td bgcolor="#e5e5cc">
<xsl:call-template name="jazz.method.request"/>
      </td>
    </tr>
  </table>

  <br/><br/>
  <xsl:if test="$method.element">
    <p>The following is the XML response. </p>
    <table cellpadding="10">
      <tr>
        <td bgcolor="#e5e5cc">
<xsl:call-template name="jazz.method.response"/>
        </td>
      </tr>
    </table>
  </xsl:if>

</xsl:template>

<xsl:template name="jazz.method.response"> 
  <span class="comment">&lt;--jazz.method.response--&gt;</span>
        <code>
          &lt;?xml version="1.0" encoding="utf-8"?&gt;<br/>
          &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;<br/>
          &#160;&#160;&lt;soap:Body&gt;<br/>
          &#160;&#160;&#160;&#160;&lt;<xsl:value-of select="$method.response.element/@name"/> xmlns="<xsl:value-of select="$service.namespace"/>"&gt;<br/>
          <xsl:call-template name="specimen.invoke">
            <xsl:with-param name="for" select="$method.response.element.element"/>
          </xsl:call-template>
          &#160;&#160;&#160;&#160;&lt;/<xsl:value-of select="$method.response.element/@name"/>&gt;<br/>
          &#160;&#160;&lt;/soap:Body&gt;<br/>
          &lt;/soap:Envelope&gt;<br/>
        </code>  
</xsl:template>

<xsl:template name="jazz.method.request">
  <span class="comment">&lt;--jazz.method.request--&gt;</span>
        <code>
          &lt;?xml version="1.0" encoding="utf-8"?&gt;<br/>
          &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;<br/>
          &#160;&#160;&lt;soap:Body&gt;<br/>
          &#160;&#160;&#160;&#160;&lt;<xsl:value-of select="$method"/> xmlns="<xsl:value-of select="$service.namespace"/>"&gt;<br/>
          <xsl:call-template name="specimen.invoke"/>
          &#160;&#160;&#160;&#160;&lt;/<xsl:value-of select="$method"/>&gt;<br/>
          &#160;&#160;&lt;/soap:Body&gt;<br/>
          &lt;/soap:Envelope&gt;<br/>
        </code>  
</xsl:template>

<xsl:template name="jazz.result.node">
  <xsl:param name="elements"/>
  <xsl:param name="indent"/>
  <xsl:variable name="element" select="$elements[1]"/>
  <xsl:variable name="next" select="$elements[position()!=1]"/>
  <xsl:variable name="type" select="substring-after($element/@type,':')"/>
  <xsl:variable name="ref.key" select="//*[local-name()='schema']/*[local-name()='complexType'][@name=$type]"/>
  <span class="comment" color="green">&lt;--jazz.result.node--&gt;</span>
  <br/><xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$element/@name"/>&gt;<xsl:call-template name="jazz.result">
    <xsl:with-param name="element" select="$element"/>
    <xsl:with-param name="indent" select="concat($indent,'&#160;&#160;')"/>
  </xsl:call-template><xsl:if test="$ref.key">
    <br/>
    <xsl:value-of select="$indent"/>
  </xsl:if>&lt;/<xsl:value-of select="$element/@name"/>&gt;
  <xsl:if test="$next">
    <xsl:call-template name="jazz.result.node">
      <xsl:with-param name="elements" select="$next"/>
      <xsl:with-param name="indent" select="$indent"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

<xsl:template name="jazz.result">
  <xsl:param name="element"/>
  <xsl:param name="indent"/>
  <xsl:param name="count">0</xsl:param>
  <!-- get the @NAME of this element -->
  <xsl:variable name="name" select="$element/@name"/>
  <!-- get the @TYPE of this element -->
  <xsl:variable name="type" select="substring-after($element/@type,':')"/>
  <!-- look for any complexTypes with this name -->
  <xsl:variable name="ref.key" select="//*[local-name()='schema']/*[local-name()='complexType'][@name=$type]"/>
  <!-- look for any child elements for the complexType -->
  <xsl:variable name="ref.node" select="$ref.key/*[local-name()='sequence']/*[local-name()='element']"/>
  <span class="comment" color="green">&lt;--jazz.result--&gt;</span>
  <xsl:choose>
    <xsl:when test="$ref.key">
      <!-- for each child element, write its TYPE -->
      <xsl:call-template name="jazz.result.node">
        <xsl:with-param name="elements" select="$ref.node"/>
        <xsl:with-param name="indent" select="$indent"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <!-- when no children are left, write the TYPE -->
      <b class="datatype">
        <xsl:value-of select="$type"/>
      </b>
    </xsl:otherwise>
  </xsl:choose>
  </xsl:template>

  <xsl:template name="jazz.struct">
    <xsl:param name="group" select="//*[local-name()='complexType'][@name=$method]"/>
    <span class="comment" color="green">&lt;--jazz.struct--&gt;</span>
    <br/>
    <p class='intro'>
      Click <a href='/{$path}'>here</a> for a complete list of operations in <xsl:value-of select="$service.name"/>
    </p>
    <xsl:apply-templates select="$group[1]"/>

    
  </xsl:template>

  <xsl:template name="jazz.enum">
    <span class="comment" color="green">&lt;--jazz.enum--&gt;</span>
    <br/>
    <p class='intro'>
      Click <a href='/{$path}'>here</a> for a complete list of operations in <xsl:value-of select="$service.name"/>
    </p>
    <xsl:apply-templates select="//*[local-name()='simpleType'][@name=$method]"/>

  </xsl:template>

  <xsl:template name="parse.element">
    <xsl:param name="for"/>
    <xsl:variable name="me.element" select="//*[local-name()='element'][@name=$for]"/>
    <xsl:variable name="me.complex" select="//*[local-name()='complexType'][@name=$for]"/>
    <span class="comment">&lt;--parse.element--&gt;</span>
    <tr>
    <xsl:choose>
      <xsl:when test="$me.element"> 
        <td nowrap="nowrap">
          <span class="comment">&lt;--me.element--&gt;</span>
          <table cellspacing="0" cellpadding="2" style="border:dotted 1px silver" bgcolor="white">
            <xsl:call-template name="parse.element.item">
              <xsl:with-param name="for" select="$me.element/*/*[local-name()='sequence']/*"/>
            </xsl:call-template>
          </table>
        </td>
      </xsl:when>
      <xsl:when test="$me.complex">
        <td valign="top">
          <span class="comment">&lt;--me.complex--&gt;</span>
          <img id="img{$me.complex/@name}" src="/webservices/images/explorer/splus.gif" align="absmiddle"/>
          <a href="#" style="font-weight:normal;color:blue"  class="normal" onclick="toggle('tbl{$me.complex/@name}', 'img{$me.complex/@name}')"
                   >
            <xsl:value-of select="$me.complex/@name"/>
          </a>
        </td>
        <td nowrap="nowrap" valign="top">
          <table id="tbl{$me.complex/@name}" style="display:none;border:dotted 1px silver" cellspacing="0" cellpadding="2" >
        <xsl:call-template name="parse.element.item">
          <xsl:with-param name="for" select="$me.complex/*[local-name()='sequence']/*"/>
        </xsl:call-template> 
          </table>
        </td>
      </xsl:when>
    </xsl:choose>
    </tr>

  </xsl:template>

  <xsl:template name="parse.element.item">
    <xsl:param name="for"/>
    <xsl:param name="omit">,</xsl:param>
    <xsl:param name="me" select="$for[1]"/>
    <xsl:param name="next" select="$for[position()!=1]"/>
    <xsl:param name="clone" select="$me/preceding::*[local-name()=local-name($me)][@name=$me/@name]"/>
    <span class="comment" color="green">&lt;--parse.element.item--&gt;</span>
    <xsl:if test="not (contains($omit,concat(',',$me/@name,',')))">
      <tr>
        <xsl:choose>
          <xsl:when test="$me/@type">
            <td nowrap="nowrap">
                <small>
                  <i>
                    <xsl:value-of select="substring-after($me/@type,':')"/>
                  </i>
                  </small>&#160;
                <xsl:value-of select="$me/@name"/> 
              <br/>
              <input name="{$me/@name}"/>
            </td>
          </xsl:when>
          <xsl:otherwise>
            <td valign="top">
              <img id="img{$me/@name}" src="/webservices/images/explorer/splus.gif" align="absmiddle"/>
              <a href="#"  style="font-weight:normal;color:blue" class="normal" onclick="toggle('tbl{$me/@name}', 'img{$me/@name}')"
                   >
                <xsl:value-of select="$me/@name"/>
              </a>
              <br/>
              <table id="tbl{$me/@name}" style="display:none;border:dotted 1px silver" cellspacing="0" cellpadding="2">
                <xsl:call-template name="parse.element">
                  <xsl:with-param name="for" select="$me/@name"/>
                </xsl:call-template>
              </table>
            </td>
          </xsl:otherwise>
        </xsl:choose>
      </tr>
    </xsl:if>
    <xsl:if test="$next">
      <xsl:call-template name="parse.element.item">
        <xsl:with-param name="for" select="$next"/>
        <xsl:with-param name="omit" select="concat($omit,$me/@name,',')"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name="form.enum">
	<xsl:param name="for" select="$enum.list"/>
	<xsl:param name="index">0</xsl:param>
	<xsl:param name="type"/>
	<xsl:param name="me" select="$for[1]"/>
    <xsl:param name="next" select="$for[position()!=1]"/>

          <option value="{$index}">
            <xsl:value-of select="concat($type,'.',$me/@value)"/>
          </option>
	
	<xsl:if test="$next">
		<xsl:call-template name="form.enum">
			<xsl:with-param name="for" select="$next"/>
			<xsl:with-param name="type" select="$type"/>
			<xsl:with-param name="index" select="$index + 1"/>
		</xsl:call-template>
	</xsl:if>
  </xsl:template>

  <xsl:template name="form.invoke">
	<xsl:param name="for" select="$argument.list"/>
	<xsl:param name="me" select="$for[1]"/>
  <xsl:param name="next" select="$for[position()!=1]"/>
  <xsl:param name="me.type" select="substring-after($me/@type,':')"/>
  <xsl:variable name="enum" select="//*[local-name()='simpleType'][@name=$me.type]/*[local-name()='restriction']/*[local-name()='enumeration']"/>

    <span class="comment">&lt;--form.invoke--&gt;</span>
  <xsl:if test="string-length($me/@name) &gt; 0">
		<tr><td nowrap="nowrap">
      <small>
        <i><xsl:value-of select="$me.type"/></i>
      </small>
			<xsl:value-of select="concat(' ',$me/@name)"/>
      (<a style="font-size:7pt" onclick="if(!confirm('Are you sure??')) return false;"  href="/{$path}/{$method}/{$me/@name}/remove">delete</a>)
			<br/>
      <xsl:choose>
        <xsl:when test="$enum">
          <select name="{$me/@name}">
            <option value=""> </option>
                <xsl:call-template name="form.enum">
                    <xsl:with-param name="for" select="$enum"/>
                    <xsl:with-param name="type" select="$me.type"/> 
                </xsl:call-template>
<!--            <xsl:for-each select="$enum">
              <option value="{@value}">
                <xsl:value-of select="concat($me.type,'.',@value)"/>
              </option>
            </xsl:for-each>-->
          </select>
        </xsl:when>
        <xsl:when test="substring-before($me/@type,':')=substring-before($service.prefix,':')">
          <table cellspacing="0" cellpadding="2" style="border:dotted 1px silver" bgcolor="white"> 
          <xsl:call-template name="parse.element">
            <xsl:with-param name="for" select="$me.type"/>
          </xsl:call-template>
          </table>
        </xsl:when>
        <xsl:otherwise>
          <input size="25" name="{$me/@name}"/>
        </xsl:otherwise>
      </xsl:choose> 
    </td></tr>
	</xsl:if>

	<xsl:if test="$next">
		<xsl:call-template name="form.invoke">
			<xsl:with-param name="for" select="$next"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

  <xsl:template name="specimen.custom.type">
    <xsl:param name="me"/>
    <xsl:param name="indent"/>
    <xsl:param name="type"/>
    <span class="comment">&lt;--specimen.custom.type--&gt;<br/></span>
    <xsl:if test="string-length($me/@name) &gt; 0">
<xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me/@name"/>&gt;<br/>
    </xsl:if>
          <xsl:call-template name="parse.specimen"><!-- complex data types -->
            <xsl:with-param name="start" select="$me"/>
            <xsl:with-param name="for" select="$type"/>
            <xsl:with-param name="indent"><xsl:value-of select="concat($indent,'&#160;&#160;&#160;&#160;')"/></xsl:with-param>
          </xsl:call-template>
    <xsl:if test="string-length($me/@name) &gt; 0">
<xsl:value-of select="$indent"/>&lt;/<xsl:value-of select="$me/@name"/>&gt;<br/> 
    </xsl:if>
  </xsl:template>

  <xsl:template name="specimen.ref.type">
    <xsl:param name="me"/>
    <xsl:param name="indent"/>
    <xsl:param name="ref"/>
    <span class="comment">&lt;--specimen.ref.type--&gt;<br/></span>
    <xsl:value-of select="$indent"/>&#160;&#160;&#160;&#160;&lt;<xsl:value-of select="substring-after($ref,':')"/>&gt;<br/>
          <xsl:call-template name="parse.specimen">
            <!-- referenced data types -->
            <xsl:with-param name="start" select="$me"/>
            <xsl:with-param name="for" select="substring-after($ref,':')"/>
            <xsl:with-param name="indent"><xsl:value-of select="concat($indent,'&#160;&#160;&#160;&#160;')"/></xsl:with-param>
          </xsl:call-template>
<xsl:value-of select="$indent"/>&#160;&#160;&#160;&#160;&lt;/<xsl:value-of select="substring-after($ref,':')"/>&gt;<br/>
  </xsl:template>

  <xsl:template name="specimen.child.type">
    <xsl:param name="me"/>
    <xsl:param name="indent"/>
    <xsl:param name="children"/>
    <span class="comment">&lt;--specimen.child.type--&gt;<br/></span>
    <xsl:if test="string-length($me/@name) &gt; 0">
<xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me/@name"/>&gt;<br/>
    </xsl:if>
          <xsl:call-template name="specimen.invoke"><!-- child data types -->
            <xsl:with-param name="for" select="$children"/>
            <xsl:with-param name="indent"><xsl:value-of select="concat($indent,'&#160;&#160;&#160;&#160;')"/></xsl:with-param>
          </xsl:call-template>
    <xsl:if test="string-length($me/@name) &gt; 0">
<xsl:value-of select="$indent"/>&lt;/<xsl:value-of select="$me/@name"/>&gt;<br/> 
    </xsl:if>    
  </xsl:template>
  
  <xsl:template name="specimen.invoke">
    <xsl:param name="for" select="$argument.list"/>
    <xsl:param name="me" select="$for[1]"/>
    <xsl:param name="indent">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</xsl:param>
    <xsl:param name="next" select="$for[position()!=1]"/>
    <xsl:param name="ref" select="$me/@ref"/>
    <xsl:param name="children" select="$me/*[local-name()='complexType']/*[local-name()='sequence']/*[local-name()='element']"/>
    <xsl:param name="type">
      <xsl:choose>
        <xsl:when test="contains($me/@type,':')">
          <xsl:value-of  select="substring-after($me/@type,':')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$me/@type"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:param>
    <xsl:variable name="enum" select="//*[local-name()='simpleType'][@name=$type]/*[local-name()='restriction']/*[local-name()='enumeration']"/>
    <span class="comment">&lt;--specimen.invoke--&gt;<br/></span>
    <span class="comment" color="green">&lt;--&lt;<xsl:value-of select="name($me)"/><xsl:for-each select="$me/@*">
      &#160;<xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:for-each>&gt;--&gt;<br/></span><xsl:if test="$me">
      <xsl:choose>
         <xsl:when test="$enum"><xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me/@name"/>&gt;<b class="datatype"><xsl:value-of select="$type"/></b>&lt;/<xsl:value-of select="$me/@name"/>&gt;<br/></xsl:when>
       <xsl:when test="substring-before($me/@type,':')=substring-before($service.prefix,':')"><span class="comment">&lt;--<xsl:value-of select="$type"/>--&gt;<br/></span>
          <xsl:call-template name="specimen.custom.type">
            <xsl:with-param name="me" select="$me"/>
            <xsl:with-param name="indent" select="$indent"/>
            <xsl:with-param name="type" select="$type"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="$ref"><span class="comment">&lt;--referenced data type--&gt;<br/></span>
          <xsl:call-template name="specimen.ref.type">
            <xsl:with-param name="me" select="$me"/>
            <xsl:with-param name="indent" select="$indent"/>
            <xsl:with-param name="ref" select="$ref"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="$children">
          <span class="comment">&lt;--<xsl:value-of select="count($children)"/> children--&gt;<br/></span>
          <xsl:call-template name="specimen.child.type">
            <xsl:with-param name="me" select="$me"/>
            <xsl:with-param name="indent" select="$indent"/>
            <xsl:with-param name="children" select="$children"/>
          </xsl:call-template>
        </xsl:when> <!-- simple data types-->
        <xsl:otherwise><xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me/@name"/>&gt;<b class="datatype"><xsl:value-of select="$type"/></b>&lt;/<xsl:value-of select="$me/@name"/>&gt;<br/></xsl:otherwise>
      </xsl:choose>
    <xsl:if test="$next">
      <xsl:call-template name="specimen.invoke">
        <xsl:with-param name="for" select="$next"/>
      </xsl:call-template>
    </xsl:if></xsl:if> 
  </xsl:template>

  <xsl:template name="parse.specimen">
    <!-- element or complexType @name -->
    <xsl:param name="start" select="//*"/>
    <xsl:param name="for"/>
    <xsl:param name="indent"/> 
    <xsl:variable name="me.element" select="//*[local-name()='element'][@name=$for]"/>
    <xsl:variable name="me.complex" select="//*[local-name()='complexType'][@name=$for]"/> 
    <span class="comment">&lt;--parse.specimen (<xsl:value-of select="$for"/>) --&gt;<br/></span>
    <xsl:choose> 
      <xsl:when test="$me.complex">
          <span class="comment">&lt;--//*[local-name()='complexType'][@name=<xsl:value-of select="$for"/>]--&gt;<br/></span>
        <xsl:call-template name="parse.specimen.item">
          <xsl:with-param name="for" select="$me.complex/*[local-name()='sequence']/*"/>
          <xsl:with-param name="indent" select="concat($indent,'&#160;&#160;&#160;&#160;')"/>
        </xsl:call-template> 
      </xsl:when> 
      <xsl:when test="$me.element"> 
          <span class="comment">&lt;--//*[local-name()='element'][@name=<xsl:value-of select="$for"/>] --&gt;<br/></span>
            <xsl:call-template name="parse.specimen.item">
              <xsl:with-param name="for" select="$me.element/*/*[local-name()='sequence']/*"/>
              <xsl:with-param name="indent" select="concat($indent,'&#160;&#160;&#160;&#160;')"/>
            </xsl:call-template>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="p.s.a">
    <xsl:param name="me"/>
        <span class="comment" color="green">&lt;--p.s.a--&gt;</span>
      <xsl:for-each select="$me">&#160;<xsl:value-of select="@name"/>="<b class="datatype"><xsl:value-of select="substring-after(@type,':')"/></b>"</xsl:for-each>
  </xsl:template>

  <xsl:template name="parse.specimen.item">
    <xsl:param name="for"/>
    <xsl:param name="indent"/>
    <xsl:param name="omit">,</xsl:param>
    <xsl:param name="me" select="$for[1]"/>
    <xsl:param name="me.name" select="$me/@name"/>
    <xsl:param name="me.type" select="$me/@type"/>
    <xsl:param name="me.ref" select="substring-after($me/@ref,':')"/>
    <xsl:param name="me.prefix" select="substring-before($me.type,':')"/>
    <xsl:param name="me.suffix" select="substring-after($me.type,':')"/>
    <xsl:param name="me.attributes" select="$me/*/*[local-name()='attribute']"/>
    <xsl:param name="me.elements" select="$me/*/*/*[local-name()='element']"/>
    <xsl:param name="me.simple" select="//*[local-name()='simpleType'][@name=$me.suffix]"/> 
    <xsl:variable name="next" select="$for[position()!=1]"/>
    <xsl:variable name="me.tag">
      <xsl:choose>
        <xsl:when test="$me/@name"><xsl:value-of select="$me.name"/></xsl:when>
        <xsl:when test="$me/@ref"><xsl:value-of select="$me/@ref"/></xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:if test="$me">
      <xsl:if test="not (contains($omit,concat(',',$me.tag,',')))">
        <span class="comment">&lt;--parse.specimen.item--&gt;<br/></span>
        <span class="comment">
          &lt;--&lt;<xsl:value-of select="name($me)"/><xsl:for-each select="$me/@*">
            &#160;<xsl:value-of select="name()"/>="<xsl:value-of select="."/>"
          </xsl:for-each>&gt;--&gt;<br/>
        </span>
        <xsl:choose>
          <xsl:when test="$me.simple">
            <xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me.name"/><xsl:call-template name="p.s.a">
              <xsl:with-param name="me" select="$me.attributes"/>
            </xsl:call-template>&gt;<b class="datatype">
              <xsl:value-of select="$me.suffix"/>
            </b>&lt;/<xsl:value-of select="$me.name"/>&gt;<br/>
          </xsl:when>
          <xsl:when test="$me.prefix=substring-before($service.prefix,':')">
            <xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me.name"/><xsl:call-template name="p.s.a">
              <xsl:with-param name="me" select="$me.attributes"/>
            </xsl:call-template>&gt;<br/>
            <xsl:call-template name="parse.specimen">
              <!-- ...look for child elements --> 
              <xsl:with-param name="for" select="$me.suffix"/>
              <xsl:with-param name="indent" select="concat($indent,'&#160;&#160;&#160;&#160;')"/>
            </xsl:call-template>
            <xsl:value-of select="$indent"/>&lt;/<xsl:value-of select="$me.name"/>&gt;<br/>
          </xsl:when>
          <!-- if object has a @TYPE, draw as #text node -->
          <xsl:when test="$me.type">
            <xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me.name"/><xsl:call-template name="p.s.a">
              <xsl:with-param name="me" select="$me.attributes"/>
            </xsl:call-template>&gt;<b class="datatype">
              <xsl:value-of select="$me.suffix"/>
            </b>&lt;/<xsl:value-of select="$me.name"/>&gt;<br/>
          </xsl:when>
          <!-- if object has a @REF, draw node and... -->
          <xsl:when test="$me/@ref">
            <xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me.ref"/><xsl:call-template name="p.s.a">
              <xsl:with-param name="me" select="$me.attributes"/>
            </xsl:call-template>&gt;<br/>
            <xsl:call-template name="parse.specimen">
              <!-- ...look for child elements --> 
              <xsl:with-param name="for" select="$me.ref"/>
              <xsl:with-param name="indent" select="concat($indent,'&#160;&#160;&#160;&#160;')"/>
            </xsl:call-template>
            <xsl:value-of select="$indent"/>&lt;/<xsl:value-of select="$me.ref"/>&gt;<br/>
          </xsl:when>
          <!-- if object does not have a @TYPE, draw node and... -->
          <xsl:otherwise>
            <xsl:value-of select="$indent"/>&lt;<xsl:value-of select="$me.name"/><xsl:call-template name="p.s.a">
              <xsl:with-param name="me" select="$me.attributes"/>
            </xsl:call-template><xsl:choose><xsl:when test="$me.elements">&gt;<br/>
            <xsl:call-template name="parse.specimen"><!-- ...look for child elements --> 
              <xsl:with-param name="for" select="$me.name"/>
              <xsl:with-param name="indent" select="concat($indent,'&#160;&#160;&#160;&#160;')"/>
            </xsl:call-template><xsl:value-of select="$indent"/>&lt;/<xsl:value-of select="$me.name"/>&gt;</xsl:when>
            <xsl:otherwise>/&gt;</xsl:otherwise></xsl:choose><br/>
          </xsl:otherwise>
        </xsl:choose> 
    </xsl:if></xsl:if>
    <xsl:if test="$next"><span class="comment">(<xsl:value-of select="count($next)"/>)<br/></span>
      <xsl:call-template name="parse.specimen.item">
        <xsl:with-param name="for" select="$next"/>
        <xsl:with-param name="omit" select="concat($omit,$me.tag,',')"/>
        <xsl:with-param name="indent" select="$indent"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
 
  <xsl:template name="member.listitem">
    <xsl:param name="item.href.delete"/>
    <xsl:param name="item.href.go">javascript:alert('This item not implemented')</xsl:param>
    <xsl:param name="item.icon">/webservices/images/i.s.class.gif</xsl:param>
    <xsl:param name="item.type">Class</xsl:param>
    <xsl:param name="item.caption"/>
    <xsl:param name="item.modifier">public</xsl:param><span class="comment" color="green">&lt;--member.listitem--&gt;</span>
    (<a style="font-size:7pt">
      <xsl:if test="string-length($item.href.delete) &gt; 0">
        <xsl:attribute name="onclick">if(!confirm('Are you sure??')) return false;</xsl:attribute>
        <xsl:attribute name="href">
          <xsl:value-of select="$item.href.delete"/>
        </xsl:attribute>
      </xsl:if>delete
    </a>)
    <img src="{$item.icon}" align="absmiddle"/>&#160;
    <code>
      <xsl:value-of select="$item.modifier"/>&#160;<b class="datatype">
        <xsl:value-of select="$item.type"/>
      </b>&#160;<a
        href="{item.href.go}" style="font-weight:normal;color:navy">
        <xsl:value-of select="$item.caption"/>
      </a>
    </code>
    <br/>
  </xsl:template>

  <xsl:template name="datatype.complex">
    <xsl:param name="for" select="//*[local-name()='schema']/*[local-name()='complexType']"/>
    <xsl:param name="me" select="$for[1]"/>
    <xsl:param name="next" select="$for[position()!=1]"/>
    <xsl:variable name="name" select="$me/@name"/>
    <xsl:variable name="type" select="$me/*[local-name()='sequence']/*[local-name()='element']"/>
    <span class="comment" color="green">&lt;--datatype.complex--&gt;</span>
    <xsl:if test="$me">
      (<a style="font-size:7pt" onclick="if(!confirm('Are you sure??')) return false;"  href="/{$path}/{$name}/__remove_type__">delete</a>)
      <img src="/webservices/images/i.s.class.gif" align="absmiddle"/>
      <code>
        public <b class="datatype">Class</b>&#160;<a href="/{$path}/{$name}/struct" style="font-weight:normal;color:navy">
          <xsl:value-of select="$name"/>
        </a>
      </code>
      <br/>
      <xsl:if test="$next">
      <xsl:call-template name="datatype.complex">
        <xsl:with-param name="for" select="$next"/>
      </xsl:call-template>
    </xsl:if></xsl:if>
</xsl:template>

  <xsl:template name="datatype.simple">
    <xsl:param name="for" select="//*[local-name()='schema']/*[local-name()='simpleType']"/>
    <xsl:param name="me" select="$for[1]"/>
    <xsl:param name="next" select="$for[position()!=1]"/>
    <xsl:variable name="name" select="$me/@name"/>
    <xsl:variable name="type" select="$me/*[local-name()='restriction']"/>
    <span class="comment" color="green">&lt;--datatype.simple--&gt;</span><xsl:if test="$me">
    (<a style="font-size:7pt" onclick="if(!confirm('Are you sure??')) return false;"  href="/{$path}/{$name}/__remove_type__">delete</a>)
    <img src="/webservices/images/i.s.enum.gif" align="absmiddle"/>
    <code>
      public <b class="datatype">enum</b>&#160;<a href="/{$path}/{$name}/enum" style="font-weight:normal;color:navy">
        <xsl:value-of select="$name"/>
      </a>
    </code>
    <br/>
    <xsl:if test="$next">
      <xsl:call-template name="datatype.simple">
        <xsl:with-param name="for" select="$next"/>
      </xsl:call-template>
    </xsl:if></xsl:if>
  </xsl:template>

<xsl:template match="//*[local-name()='file']">
  <span class="comment">&lt;--//*[local-name()='file']--&gt;</span>
  <tr>
    <td>
      <a style="font-weight:normal"  href="{@path}"><xsl:value-of select="@title"/></a>
    </td>
    <td>
      <xsl:value-of select="@name"/>
    </td>
    <td>
      <xsl:value-of select="@size"/>
    </td>
    <td>
      <xsl:value-of select="@date"/>
    </td>
  </tr>
</xsl:template>

<xsl:template match="//*[local-name()='element']">
  <span class="comment" color="green">&lt;--//*[local-name()='element']--&gt;<br/></span>
	<xsl:for-each select="./*[local-name()='complexType']/*[local-name()='sequence']/*[local-name()='element']">
		<b>
			<xsl:choose>
				<xsl:when test="contains(@type,':')">
					<xsl:value-of  select="substring-after(@type,':')"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="@type"/>
				</xsl:otherwise>
			</xsl:choose>
		</b>&#160;<i>
			<xsl:value-of select="@name"/>
		</i>
		<xsl:if test="following-sibling::*[local-name()='element']">, </xsl:if>
	</xsl:for-each>
</xsl:template>

<xsl:template match="//*[local-name()='portType']/*[local-name()='operation']">
  <xsl:param name="hide">true</xsl:param>
	<xsl:variable name="name" select="@name"/>
  <xsl:variable name="op.input" select="./*[local-name()='input']/@message"/>
  <xsl:variable name="op.output" select="./*[local-name()='output']/@message"/>
  <xsl:variable name="msg.input.name" select="substring-after($op.input,':')"/>
  <xsl:variable name="msg.output.name" select="substring-after($op.output,':')"/>
  <xsl:variable name="msg.input.element" select="//*[local-name()='message'][@name=$msg.input.name]/*[local-name()='part']/@element"/>
  <xsl:variable name="msg.output.element" select="//*[local-name()='message'][@name=$msg.output.name]/*[local-name()='part']/@element"/>
  <xsl:variable name="msg.input.element.name" select="substring-after($msg.input.element,':')"/>
  <xsl:variable name="msg.output.element.name" select="substring-after($msg.output.element,':')"/>
  <xsl:variable name="response" select="//*[local-name()='element'][@name=$msg.output.element.name]"/>
	<xsl:variable name="type" select="$response/*[local-name()='complexType']/*[local-name()='sequence']/*[local-name()='element']"/>
	<xsl:variable name="type.name">
		<xsl:choose>
      <xsl:when test="$type/*[local-name()='complexType']"><xsl:value-of select="$type/@name"/></xsl:when>
      <xsl:when test="contains($type/@type,':')">
        <xsl:value-of  select="substring-after($type/@type,':')"/>
      </xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$type/@type"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
  <span class="comment" color="green">
    &lt;--//*[local-name()='portType']/*[local-name()='operation']--&gt;<br/>
  </span>
  <xsl:if test="not (preceding::*[local-name()='operation'][@name=$name])">
    <xsl:if test="$hide='true'">
      (<a style="font-size:7pt" onclick="if(!confirm('Are you sure??')) return false;"  href="/{$path}/{@name}/__remove__">delete</a>)
      <img src="/webservices/images/i.s.method.public.gif" align="absmiddle"/>
      <code>
        public <b class="datatype">
          <xsl:value-of select="$type.name"/>
          <xsl:if test="$type/@maxOccurs='unbounded'">[]</xsl:if>
        </b>&#160;<a href="/{$path}/{@name}" style="font-weight:normal;color:navy">
          <xsl:value-of select="@name"/>
        </a>
        (<xsl:apply-templates select="//*[local-name()='element'][@name=$name]"/>)
      </code><br/>
    </xsl:if>
    <xsl:if test="$hide='async'">

      (<u style="font-size:7pt;color:green" >delete</u>)
      <img src="/webservices/images/i.s.method.public.gif" align="absmiddle"/>
      <code style="color:green">
        public <b class="datatype" style="color:green">
          <xsl:value-of select="$type.name"/>
          <xsl:if test="$type/@maxOccurs='unbounded'">[]</xsl:if>
        </b>&#160;<xsl:value-of select="@name"/>Async
        (<xsl:apply-templates select="//*[local-name()='element'][@name=$name]"/>)
      </code>
      <br/>
    </xsl:if>
    <xsl:if test="$hide='event'">
      (<u style="font-size:7pt;color:green" >delete</u>)
      <img src="/webservices/images/i.s.event.gif" align="absmiddle"/>
      <code style="color:green">
        public <b class="datatype" style="color:green">event</b>&#160;<xsl:value-of select="@name"/>Completed
        (<b>Object</b>&#160;<i>sender</i>, <b>
          <xsl:value-of select="$service.name"/>EventArgs
        </b>&#160;<i>e</i>)
      </code><br/>
    </xsl:if>
    <xsl:if test="$hide='message'">
      (<u style="font-size:7pt;color:green" >delete</u>)
      <img src="/webservices/images/i.s.method.private.gif" align="absmiddle"/>
      <code style="color:green">
        private <b class="datatype" style="color:green">string</b>&#160;<xsl:value-of select="@name"/>Request
        (<xsl:apply-templates select="//*[local-name()='element'][@name=$name]"/>)
      </code><br/>
    </xsl:if>

  </xsl:if>

</xsl:template>

<xsl:template match="//*[local-name()='portType']">
  <xsl:param name="hide">true</xsl:param>
  <span class="comment" color="green">&lt;--//*[local-name()='portType']--&gt;</span>

	<xsl:apply-templates select="./*[local-name()='operation']">
    <xsl:with-param name="hide" select="$hide"/>
	</xsl:apply-templates>
</xsl:template>

<xsl:template match="//*[local-name()='complexType']">

  <span class="comment" color="green">&lt;--//*[local-name()='complexType']--&gt;</span>
  <br/>
  <h3>
    Members
  </h3> 
  <xsl:for-each select="./*[local-name()='sequence']/*[local-name()='element']">
    <xsl:call-template name="complex.item">
      <xsl:with-param name="me" select="."/>
    </xsl:call-template>
  </xsl:for-each>

  <xsl:for-each select="./*[local-name()='attribute']">
    <xsl:call-template name="complex.item">
      <xsl:with-param name="me" select="."/>
    </xsl:call-template>
  </xsl:for-each>


  <hr noshade="noshade"/>
  <h3>
    Add data member
  </h3>
  To add a new data member to <xsl:value-of select="@name"/>, complete the form below and click the 'Create' button.

  <xsl:call-template name="form.member.create">
    <xsl:with-param name="button.id">Member</xsl:with-param>
  </xsl:call-template> 
  <xsl:call-template name="service.wsdl"/>
</xsl:template>

<xsl:template name="service.wsdl">

            For a formal definition, please review the <a href="#" style="cursor:hand" 
                 onclick="var x=document.getElementById('msgdesc'),d=x.style.display;x.style.display=d=='none'?'inline':'none';"
                   >
              <b>Service Description</b>
            </a>
            <div id="msgdesc" style="display:none">
              <iframe width="100%" style="border:solid 1px silver;margin:2px" FRAMEBORDER="0" height="600" src="/{substring-before($path,'.jazz')}.wsdl">
                <!-- spacer -->!
              </iframe>
            </div>
</xsl:template>

<xsl:template name="complex.item">
  <xsl:param name="me"/>
  <span class="comment" color="green">&lt;--complex.item--&gt;</span>
    (<a style="font-size:7pt" onclick="if(!confirm('Are you sure??')) return false;"  href="/{$path}/{$method}/{$me/@name}/__remove_enum__">delete</a>)
    <img src="/webservices/images/i.s.property.gif" align="absmiddle"/>
    <code>
      private <b class="datatype">
        <xsl:choose>
          <xsl:when test="$me/@type"><xsl:value-of select="substring-after($me/@type,':')"/></xsl:when>
          <xsl:otherwise>Class</xsl:otherwise>
        </xsl:choose><xsl:if test="$me/@maxOccurs!='1'">[]</xsl:if></b>&#160;<a>
          <xsl:if test="not($me/@type)">
            <xsl:attribute name="href">/<xsl:value-of select="$path"/>/<xsl:value-of select="$method"/>:<xsl:value-of select="$me/@name"/>/struct</xsl:attribute>
            <xsl:attribute name="style">font-weight:normal;color:blue</xsl:attribute>
          </xsl:if>
          <xsl:if test="$me/@ref">
            <xsl:attribute name="href">/<xsl:value-of select="$path"/>/<xsl:value-of select="$method"/>:<xsl:value-of select="substring-after($me/@ref,':')"/>/struct</xsl:attribute>
            <xsl:attribute name="style">font-weight:normal;color:blue</xsl:attribute>
          </xsl:if><xsl:choose>
          <xsl:when test="$me/@name"><xsl:value-of select="$me/@name"/></xsl:when>
          <xsl:when test="$me/@ref"><xsl:value-of select="substring-after($me/@ref,':')"/></xsl:when> 
        </xsl:choose></a>
    </code><br/>
</xsl:template>

<xsl:template name="delimiter.parse">
    <xsl:param name="node" select="//*[local-name()='schema']"/>
    <xsl:param name="complex"/>
    <xsl:param name="for" select="$method"/>
    <xsl:param name="href"/>
    <xsl:variable name="predicate" select="substring-before($for,':')"/>
    <xsl:variable name="next" select="substring-after($for,':')"/>
    <xsl:variable name="value">
      <xsl:choose>
        <xsl:when test="string-length($next) &gt; 0"><xsl:value-of select="$predicate"/></xsl:when>
        <xsl:otherwise><xsl:value-of select="$for"/></xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="me.element" select="$node/descendant::*[local-name()='element'][@name=$value]"/>
    <xsl:variable name="me.complex" select="$node/descendant::*[local-name()='complexType'][@name=$value]"/>
  <xsl:variable name="me.element.complex" select="$me.element/*[local-name()='complexType']"/>
  <xsl:variable name="me.element.ref" select="$me.element/@ref"/>
  <xsl:variable name="me.element.ref.complex" select="//*[local-name()='element'][@name=substring-after($me.element.ref,':')]/*[local-name()='complexType']"/>
  <span class="comment" color="green">&lt;--delimiter.parse--&gt;</span>
  
    <xsl:choose>
      <xsl:when test="string-length($next) &gt; 0">
    <a style="font-weight:normal;color:blue"  href="/{$path}/{$href}{$value}/struct"><xsl:value-of select="$value"/></a>&#160;:
        <xsl:choose>
        <xsl:when test="$me.element">
          <xsl:call-template name="delimiter.parse">
            <xsl:with-param name="href" select="concat($href,$value,':')"/>
            <xsl:with-param name="for" select="$next"/>
            <xsl:with-param name="complex" select="$me.element/*[local-name()='complexType']"/>
            <xsl:with-param name="node" select="$me.element/*[local-name()='complexType']/*[local-name()='sequence']"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="delimiter.parse">
            <xsl:with-param name="href" select="concat($href,$value,':')"/>
            <xsl:with-param name="for" select="$next"/>
            <xsl:with-param name="complex" select="$me.complex"/>
            <xsl:with-param name="node" select="$me.complex/*[local-name()='sequence']"/>
          </xsl:call-template></xsl:otherwise>
      </xsl:choose>
      </xsl:when>
      <xsl:otherwise>
        <b>
          <xsl:value-of select="$value"/>
        </b>
        <br/>
        <br/>
        <xsl:choose>
          <xsl:when test="$me.element.ref.complex">
           <xsl:call-template name="jazz.struct">
              <xsl:with-param name="group" select="$me.element.ref.complex"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:when test="$me.element.complex">
           <xsl:call-template name="jazz.struct">
              <xsl:with-param name="group" select="$me.element.complex"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:when test="//*[local-name()='element'][@name=$value]/*[local-name()='complexType']">
           <xsl:call-template name="jazz.struct">
              <xsl:with-param name="group" select="//*[local-name()='element'][@name=$value]/*[local-name()='complexType']"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="jazz.struct">
              <xsl:with-param name="group" select="$me.element.complex"/>
            </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>  
  
<xsl:template match="//*[local-name()='simpleType']">

  <span class="comment" color="green">&lt;--//*[local-name()='simpleType']--&gt;</span>

  <h2>

                <input type="hidden" value="{@name}"  name="EnumName"/>

                <xsl:value-of select="@name"/>
                <div style="font-size:8pt;font-weight:normal">
                  Data type:
                <select name="EnumType">
                  <option value="">(Choose)</option>
                  <xsl:call-template name="data.types.list">
                    <xsl:with-param name="selected" select="substring-after(./*[local-name()='restriction']/@base,':')"/>
                  </xsl:call-template>
                </select> 
                  <input type="submit" name="SaveEnum" value="Update"/>
                </div>
              </h2>
  <br/>
  <h3>
    Members
  </h3> 
  <xsl:apply-templates select="./*[local-name()='restriction']/*[local-name()='enumeration']"/>



  <hr noshade="noshade"/>
  <h3>
    Add data member
  </h3>
  To add a new data member to <xsl:value-of select="@name"/>, complete the form below and click the 'Create' button.

  <xsl:call-template name="form.member.create">
    <xsl:with-param name="button.id">Enum</xsl:with-param>
    <xsl:with-param name="button.type">false</xsl:with-param>
  </xsl:call-template>

</xsl:template>

<xsl:template match="//*[local-name()='enumeration']">
  <xsl:variable name="me.type" select="substring-after(../@base,':')"/>
  <span class="comment" color="green">&lt;--//*[local-name()='enumeration']--&gt;</span>
  (<a style="font-size:7pt" onclick="if(!confirm('Are you sure??')) return false;"  href="/{$path}/{$method}/{@value}/__remove_enum__">delete</a>)
  <img src="/webservices/images/i.s.enum.gif" style="margin:1px" align="absmiddle"/> 
    <code>
      <b class="datatype">
        <xsl:value-of select="$me.type"/> 
      </b>&#160;<xsl:value-of select="@value"/> 
    </code> 
  <br/>
</xsl:template>


</xsl:stylesheet> 
